package com.hns.can.mainte.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hns.can.common.aop.orgTree.LeftOrgAnnotation;
import com.hns.can.common.constants.GlobalConst;
import com.hns.can.common.formula.FillCodeDscValue;
import com.hns.can.common.formula.FillParamsVo;
import com.hns.can.common.service.BaseInfoValueService;
import com.hns.can.common.vo.CommonParamsVo;
import com.hns.can.mainte.entity.CommCarChargeInfoEntity;
import com.hns.can.mainte.entity.CommChargeStDetailInfoEntity;
import com.hns.frame.mybatis.Pagination;
import com.hns.frame.service.CommonService;
import com.hns.tool.pub.PubUtil;

/**
 * 电池充放电明细Service
 * @author:zhangzq
 * @email:
 * @version Revision 2.0.0
 */
@Service
public class ChargingDetailService extends CommonService {
    
    @Autowired
    private BaseInfoValueService baseInfoValueService;
    
    /**
     * 分页查询电池充放电明细数据
     * @param params
     * @return
     * @throws Exception
     * @author:zhangzq
     * @email:
     */
    @SuppressWarnings("unchecked")
	@LeftOrgAnnotation()
    @Transactional
//    @DriverInterfaceAnnotation()
    public Pagination searchChargingDetail(CommonParamsVo params) throws Exception {
        Pagination page = this.myBatisPage("chargingDetail.chargingDetailCount", "chargingDetail.chargingDetailData", params, CommCarChargeInfoEntity.class);
        List list =  page.getData();
        baseInfoValueService.fillOrganLineLicPltNoBatteryCarType(list);
        page.setData(list);
        return page;
    }

    /**
     * 查询电池充放电明细数据
     * @param params
     * @return
     * @throws Exception
     * @author:zhangzq
     * @email:
     */
    @SuppressWarnings("unchecked")
    @LeftOrgAnnotation()
    @Transactional
//    @DriverInterfaceAnnotation()
    public List<CommCarChargeInfoEntity> getChargingDetailData(CommonParamsVo params) throws Exception {
        List list = PubUtil.convertListMapToObject(sqlMapDao.selectList("chargingDetail.chargingDetailData", params), CommCarChargeInfoEntity.class);
        baseInfoValueService.fillOrganLineLicPltNoBatteryCarType(list);
        return list;
    }
    
    /**
     * 分页查询充放电详细信息
     * @param params
     * @return
     * @throws Exception
     * @author:zhangzq
     * @email:
     */
    @SuppressWarnings("static-access")
    @Transactional
    public Pagination searchChargingDetail2(CommonParamsVo params) throws Exception {
        Pagination page = this.myBatisPage("chargingDetail.chargingDetail2Count", "chargingDetail.chargingDetail2Data", params, CommChargeStDetailInfoEntity.class);        
        List list =  page.getData();
        baseInfoValueService.fillOrganLineLicPltNoBatteryCarType(list);
        page.setData(list);   
        return page;
    }
}

